﻿@model IEnumerable<LyyCMS.Core.Models.Blog>

@{
    ViewData["Title"] = @ViewBag.cate;
}

<div class="row">
    <div class="col-md-8">
        @foreach (var blog in Model)
        {
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">@blog.Title <span>@blog.Create_At</span></h3>
                </div>
                <div class="card-body">
                    @blog.Content
                </div>
                <div class="card-footer"><a asp-action="Details" asp-route-id="@blog.Id">查看详情</a></div>
            </div>
            <div class="" style="width:100%; height:10px;clear:both;"></div>
        }
        @if (Model.Count() <= 0)
        {
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">分类:@ViewBag.cate</h3>
                </div>
                <div class="card-body">
                    @ViewBag.cate 分类下暂无内容...
                </div>
                <div class="card-footer"></div>
            </div>
        }

        <nav aria-label="Page navigation example" style="border:1px solid #0366d6;">
            <a class="nav-link" asp-action="Index" asp-route-page="@ViewBag.preview" style="display:inline-block">上一页</a>
            @for (int m = 1; m <= ViewBag.pagecount; m++)
            {
                <a class="nav-link" asp-action="Index" asp-route-page="@m" style="display:inline-block">第 @m 页</a>
            }
            <a class="nav-link" asp-action="Index" asp-route-page="@ViewBag.nextpage" style="display:inline-block">下一页</a>
        </nav>
    </div>
    <div class="col-md-4">
        <div class="card">
            <div class="card-header">
                <div class="card-title">分类: @ViewBag.cate</div>
            </div>

            <div class="card-body">
                <ul class="nav flex-column">
                    @foreach (var cate in Html.GetEnumSelectList(typeof(LyyCMS.Core.Models.BlogCategory)))
                    {
                        <li class="nav-item">
                            @if (ViewBag.cate.ToString() == cate.Text)
                            {
                                <a class="nav-link active" asp-action="CateList" asp-route-id="@cate.Value" asp-route-page="1">@cate.Text</a>
                            }
                            else
                            {
                                <a class="nav-link" asp-action="CateList" asp-route-id="@cate.Value" asp-route-page="1">@cate.Text</a>
                            }
                        </li>
                    }

                </ul>
            </div>
        </div>
    </div>
</div>

